#include<iostream>
#include<map>
#include<vector>
#include<string>
#include<cstring>
using namespace std;
typedef long long LL;
const int N = 1e3 + 10, M = N * 2;
string s;
int n;
LL l, r;
int h[N], e[M], ne[M], idx;
LL ans;
void add(int a, int b)
{
	e[idx] = b, ne[idx] = h[a], h[a] = idx++;
}

void dfs(int u, int fa, LL last, int step)
{
	if (last > r)return;
	if (last >= l && last <= r && step >= 2) {
		//cout << "last===" << last << endl;
		ans++;
	}
	for (int i = h[u]; ~i; i = ne[i]) {
		int j = e[i];
		if (j == fa)continue;
		dfs(j, u, last * 2 + (s[j] - '0'), step + 1);
	}
}
int main()
{
	cin >> n >> l >> r;
	cin >> s;
	s = " " + s;
	memset(h, -1, sizeof(h));
	for (int i = 0; i < n - 1; i++) {
		int a, b;
		cin >> a >> b;
		add(a, b);
		add(b, a);
	}
	for (int i = 1; i <= n; i++) {
		dfs(i, 0, (LL)s[i] - '0', 1);
	}
	cout << ans << endl;
	return 0;
}